
import { request,BASEURL} from '../../utils/request';
Page({

  /**
   * 页面的初始数据
   */
  data: {
    show: false,
    index: 1,
    goodsMnie:{}
  },
  //提现
  tixian(e) {
    let {index} = e.currentTarget.dataset
    //判断是否登录
    var uid = wx.getStorageSync('uid')
    if (!uid) {
      wx.navigateTo({
        url: '/pages/login/login',
      })
      return
    } else {
      if(index==1){
        wx.navigateTo({
          url: '/pages/audit/audit',
        })
      }else if(index==2){
        wx.navigateTo({
          url: '/pages/inivit/inivit'
        })
      }
    }
  },
  onLoad: function (options) {
  },
  //获取余额
  async userInfo(){
    let {openid} = wx.getStorageSync('uid')
    let res = await request({
      url: '/api/Wxapp/userInfo',
      method:"POST",
      data:{
        openid
      }
    })
    console.log(res)
    let goodsMnie = res.data.data
    this.setData({
      goodsMnie,
      BASEURL
    })
  },


  onShow: function () {
    
    this.userInfo()
  },

  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
    let {openid} = wx.getStorageSync('uid')
    return {
      title: "邀请好友",
      path:`/pages/index/index?pid=${openid}` 
    }
  }
})